

LISPBM := ../../

include $(LISPBM)/lispbm.mk

PLATFORM_INCLUDE = -I$(LISPBM)/platform/linux/include
PLATFORM_SRC     = $(LISPBM)/platform/linux/src/platform_mutex.c \
                   $(LISPBM)/platform/linux/src/platform_timestamp.c

#CCFLAGS = -g -O2 -Wall -Wextra -Wshadow -Wconversion -Wclobbered -pedantic -std=c99

# -DLBM_ALWAYS_GC

LBMFLAGS = -DFULL_RTS_LIB -DLBM_USE_DYN_FUNS -DLBM_USE_DYN_MACROS -DLBM_USE_DYN_LOOPS -DLBM_USE_DYN_ARRAYS
LBM_SIZE = -DLBM_OPT_FUNDAMENTALS_SIZE -DLBM_OPT_ARRAY_EXTENSIONS_SIZE -DLBM_OPT_DISPLAY_EXTENSIONS_SIZE -DLBM_OPT_MATH_EXTENSIONS_SIZE -DLBM_OPT_MUTEX_EXTENSIONS_SIZE -DLBM_OPT_RANDOM_EXTENSIONS_SIZE -DLBM_OPT_RUNTIME_EXTENSIONS_SIZE -DLBM_OPT_SET_EXTENSIONS_SIZE -DLBM_OPT_STRING_EXTENSIONS_SIZE -DLBM_OPT_TTF_EXTENSIONS_SIZE
LBM_SIZE_AGGRESSIVE = -DLBM_OPT_FUNDAMENTALS_SIZE_AGGRESSIVE -DLBM_OPT_ARRAY_EXTENSIONS_SIZE_AGGRESSIVE -DLBM_OPT_DISPLAY_EXTENSIONS_SIZE_AGGRESSIVE -DLBM_OPT_MATH_EXTENSIONS_SIZE_AGGRESSIVE -DLBM_OPT_MUTEX_EXTENSIONS_SIZE_AGGRESSIVE -DLBM_OPT_RANDOM_EXTENSIONS_SIZE_AGGRESSIVE -DLBM_OPT_RUNTIME_EXTENSIONS_SIZE_AGGRESSIVE -DLBM_OPT_SET_EXTENSIONS_SIZE_AGGRESSIVE -DLBM_OPT_STRING_EXTENSIONS_SIZE_AGGRESSIVE -DLBM_OPT_TTF_EXTENSIONS_SIZE_AGGRESSIVEa

CCFLAGS =  -Wall -Wextra -Wshadow -Wconversion -Wclobbered -pedantic -std=c99 $(LBMFLAGS)

CCFLAGS_COV_32 = $(CCFLAGS) -m32 --coverage -g -O0 -DLONGER_DELAY
CCFLAGS_COV_64 = $(CCFLAGS) -DLBM64 --coverage -g -O0 -DLONGER_DELAY

CC=gcc

SRC = src

SOURCES = $(wildcard *.c)
EXECS = $(patsubst %.c, %.exe, $(SOURCES))

SOURCES = $(wildcard *.c)
TARGETS = $(SOURCES:.c=.exe)

all: $(TARGETS)

%.exe: %.c
	$(CC) $(CCFLAGS_COV_32) $(LISPBM_SRC) $(PLATFORM_SRC) $(LISPBM_FLAGS) $< -o $@ -I$(LISPBM)include $(PLATFORM_INCLUDE) -lpthread -lm

clean:
	rm -f $(TARGETS)
	rm -f *.gcda
	rm -f *.gcno

